import { platformEnum } from '@/pages/Release';
import { request } from '@umijs/max';

export const queryReleaseList = async (channel: string,platform: platformEnum, page: number) =>
  await request(`/release/list/${channel}/${platform}/${page}`, {
    method: 'GET',
  });

export const createRelease = async (data: {
  description: string;
  channel: string;
  version: string;
  platform: string
}) =>
  await request('/release/create', {
    method: 'POST',
    data,
  });

export const fileUpload = async (data: FormData) =>
  await request('/storage/upload', {
    method: 'POST',
    data: data,
  });

export const updateStatus = async (data: {
  channel: string;
  enabled: boolean;
  version: string;
}) => {
  await request('/release/update/enabled', {
    method: 'POST',
    data,
  });
};

export const updateDescription = async (data: {
  description: string;
  enabled: boolean;
  version: string;
}) => {
  await request('/release/update/description', {
    method: 'POST',
    data,
  });
};
